package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.BeHistoryService;
import situ.autoweter.entity.BeHistory;
import java.util.*;
/**
 * BeHistory的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class BeHistoryController {

	/** BeHistoryService服务 */
	@Autowired
	private BeHistoryService beHistoryService;
	
	/**
	 * 查询所有BeHistory数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryBeHistory", produces = {"application/json;charset=UTF-8"})
	public String find(BeHistory value,Map map) {
		 List<BeHistory> list= beHistoryService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询BeHistory数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryBeHistoryById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        BeHistory obj=  beHistoryService.findOne(id);
        map.put("BeHistory",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入BeHistory属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveBeHistory", produces = {"application/json;charset=UTF-8"})
	public String save(BeHistory value) {
		  beHistoryService.saveNotNull(value);
        return "redirect:/queryBeHistory";
	}
	
	/**
	 * 更新BeHistory属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateBeHistory", produces = {"application/json;charset=UTF-8"})
	public String update(BeHistory value) {
		  beHistoryService.updateNotNullById(value);
          return "redirect:/queryBeHistory";
	}
	
	/**
	 * 通过id删除BeHistory数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delBeHistoryById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  beHistoryService.deleteById(id);
          return "redirect:/queryBeHistory";
	}
}
